<?php

$DocRoot = $_SERVER['DOCUMENT_ROOT'];
include_once "$DocRoot/woflow/conf/db.inc.php";

class Database
{
	public function __construct($readOnly) 
	{
		$user = DBConfig::writeUser;
		$pass = DBConfig::writePass;
		$host = DBConfig::dbHost;

		if ($readOnly) 
		{
			$user = DBConfig::readUser;
			$pass = DBConfig::readPass;
		}
		
		$this->client = new MongoClient();
		$this->db = $this->client->selectDB(DBConfig::mainDB);
	}

	public function get()
	{
		return $this->db;
	}
}



?>
